package sokoban;

import java.util.Collection;
import java.util.Iterator;
import java.util.TreeSet;

public class HighscoreList implements Iterable<SokobanResult>{
	HighscoreList hs;
	private String url;

	private Collection<SokobanResult> results = new TreeSet<SokobanResult>();

	public void addResult(SokobanResult result){
		results.add(result);
	}
	public Iterator<SokobanResult> iterator(){
		return results.iterator();
	}
	public void initialiseHs(){
		
	}
	public void setUrl(String url){
		this.url=url;
	}
	public String geturl(){
		return url;
	}
	public int size(){
		return results.size();
	}
	public boolean isHs(int hs){
		System.out.println("new hs:"+hs);
		System.out.println("SIZE:"+results.size());
		if(results.size()<10){		
			return true;
			
		}
		else{
			System.out.println(((TreeSet<SokobanResult>) results).last().getMoveCount()+"");
			if( hs<((TreeSet<SokobanResult>) results).last().getMoveCount()){
				return true;
			}
		}
		return false;
	}
}
